package com.gruuf.done.model;

import com.google.appengine.api.datastore.Key;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import java.util.Date;

/**
 * Put some description
 */
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Task {

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long key;
    @Persistent
    private String userId;
    @Persistent
    private String name;
    @Persistent
    private String description;
    @Persistent
    private String type;
    @Persistent
    private Date created;
    @Persistent
    private Date expectedEnd;
    @Persistent
    private Date finished;

    public Task() {
    }

    public Task(String userId, String name, String description, String type, Date created, Date expectedEnd, Date finished) {
        this.userId = userId;
        this.name = name;
        this.description = description;
        this.type = type;
        this.created = created;
        this.expectedEnd = expectedEnd;
        this.finished = finished;
    }

    public Long getKey() {
        return key;
    }

    public String getUserId() {
        return userId;
    }

    public String getName() {
        return name;
    }

    public String getDescription() {
        return description;
    }

    public String getType() {
        return type;
    }

    public Date getCreated() {
        return created;
    }

    public Date getExpectedEnd() {
        return expectedEnd;
    }

    public Date getFinished() {
        return finished;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setType(String type) {
        this.type = type;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public void setExpectedEnd(Date expectedEnd) {
        this.expectedEnd = expectedEnd;
    }

    public void setFinished(Date finished) {
        this.finished = finished;
    }

    @Override
    public String toString() {
        return "Task: " + name + ", " + description + ", " + expectedEnd;
    }
}
